package leetcode.code2125;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int numberOfBeams(String[] bank) {
		int ans = 0;
		int m = bank.length, n = bank[0].length();
		int last = 0;
		for (int i = 0; i < m; i++) {
			String curString = bank[i];
			int curEqu = 0;
			for (int j = 0; j < n; j++) {
				if (curString.charAt(j) == '1') {
					curEqu++;
				}
			}
			if (curEqu != 0) {
				if (last != 0) {
					ans += curEqu * last;
				}
				last = curEqu;
			}
		}
		return ans;
	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
